﻿using System;

namespace _9.FiveIntegersAndSumOfSubsetIs0
{
    class FiveIntegersAndSumOfSubsetIs0
    {
        static void Main(string[] args)
        {
            //We are given 5 integer numbers. Write a program that checks if the sum of some subset of them is 0. Example: 3, -2, 1, 1, 8  1+1-2=0.

            int[] numbers;
            numbers = new int[5];
            for (int i = 0; i < numbers.Length; i++)
            {
                Console.Write((i+1)+".");
                numbers[i] = int.Parse(Console.ReadLine());
                Console.WriteLine();
            }
            Console.WriteLine();
            for (int i = 0; i < numbers.Length; i++)
            {
                Console.WriteLine((i+1)+"="+numbers[i]);
            }
            Console.WriteLine();
            for (int i = 0; i < numbers.Length; i++)
            {
                for (int j = 1; j < numbers.Length-1; j++)
                {
                    if ((numbers[i] + numbers[j]) == 0)
                    {
                        Console.WriteLine("{0}+{1}=0", numbers[i], numbers[j]);
                    }
                    
                }
            }
            Console.WriteLine("\nOther Sum of two integers == 0 - NO!");
            for (int i = 0; i < numbers.Length; i++)
            {
                for (int j = 1; j < numbers.Length - 2; j++)
                {
                    if ((numbers[i] + numbers[j] + numbers[j+1]) == 0)
                    {
                        Console.WriteLine("{0}+{1}+{2}=0", numbers[i], numbers[j], numbers[j+1]);
                    }

                }
            }
            Console.WriteLine("\nOther Sum of three integers == 0 - NO!");
            for (int i = 0; i < numbers.Length; i++)
            {
                for (int j = 1; j < numbers.Length - 2; j++)
                {
                    if ((numbers[i] + numbers[j] + numbers[j + 1] +numbers[j+2]) == 0)
                    {
                        Console.WriteLine("\n{0}+{1}+{2}+{3}=0", numbers[i], numbers[j], numbers[j + 1], numbers[j+2]);
                    }

                }
            } Console.WriteLine("\nOther Sum of four integers == 0 - NO!");
            if ((numbers[0] + numbers[1] + numbers[2] + numbers[3] + numbers[4]) == 0)
            {
                Console.WriteLine("\nSum of the five numbers is : 0");
            }
        }
    }
}
